package Chinese.Education.Identify.controller;

import Chinese.Education.Identify.pojo.Student;
import Chinese.Education.Identify.service.StudentService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/student")
public class StudentController {

    @Resource
    private StudentService studentService;
    @RequestMapping(value = "/select" , method = RequestMethod.GET)

    public Map<String, Object> selectStudent(      @RequestParam(value = "page",  defaultValue = "1")  int page,
                                                   @RequestParam(value = "limit", defaultValue = "10") int limit,
                                                   String stuName,
                                                   String stuId){
        Map<String, Object> stringObjectMap = studentService.selectStudent(page, limit, stuName, stuId);
        return stringObjectMap;

    }

    @RequestMapping(value = "/insert" , method = RequestMethod.POST)
    public Map<String, Object> insertStudent(@RequestBody Student student){
       return studentService.insertStudent(student);

    }

    @RequestMapping(value = "/delete" , method = RequestMethod.POST)
    public Map<String, Object> deleteStudent(@RequestBody Student student){
        return studentService.deleteStudent(student);
    }

    @RequestMapping(value = "/update" , method = RequestMethod.POST)
    public Map<String, Object> updateStudent(@RequestBody Student student){
        return studentService.updateStudent(student);
    }


}
